"""
python多线程编程
    1.导入threading模块
    2.threading.Thread()
    3.target：要执行的目标任务func
    4.传参：1.args元组方式  2.kwargs：字典方式
"""
import time
import threading


def sing(msg):
    while True:
        print(msg)
        time.sleep(1)
  

def dance(msg):
    while True:
        print(msg)
        time.sleep(1)


if __name__ == '__main__':
    # 创建一个唱歌的线程
    sing_thread = threading.Thread(target=sing, args=("我要唱歌",))
    # 创建一个跳舞的线程
    dance_thread = threading.Thread(target=dance, kwargs={'msg': "我要跳舞"})
    # 启动线程
    sing_thread.start()
    dance_thread.start()
